package com.yonyou.pmclouds.billview.plugin;

import com.yonyou.pmclouds.basecom.consts.BillTypeConst;
import com.yonyou.pmclouds.basecom.entity.SuperVO;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.basecom.util.CommonFieldConst;
import com.yonyou.pmclouds.businessobject.util.BusinessObjectConsts;
import com.yonyou.pmclouds.outter.user.UserInfoQuery;
import com.yonyou.pmclouds.processphoto.entity.ProcessPhotoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@Component
public class ProcessPhotoViewPlugin implements IBillViewCustomPlugin {
    @Autowired
    private UserInfoQuery userInfoQuery;

    @Override
    public Object[] fillListBuziField(Object[] objects) throws BusinessException {
        return objects;
    }

    @Override
    public Map<String, Object[]> fillDetailBuziField(SuperVO superVO, HttpServletRequest request) throws BusinessException {
        userInfoQuery.tranUserInfoField(new SuperVO[]{superVO} ,new String[]{CommonFieldConst.CREATOR},new String[]{ProcessPhotoVO.CREATOR_NAME});

        Map<String,Object[]> resultMap = new HashMap<>();
        resultMap.put(BusinessObjectConsts.PM_PROCESSPHOTO,new SuperVO[]{superVO});
        return resultMap;
    }

    @Override
    public String getBillType() {
        return BillTypeConst.PROCESSPHOTO_BILLTYPE;
    }
}
